package com.gofun.framework.core.logger;

import java.net.Inet4Address;
import java.net.UnknownHostException;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;

/**
 * 在日志中输出服务器地址
 * 
 * @author DannyGe
 *
 */
public class HostAddressConvert extends ClassicConverter {

  @Override
  public String convert(ILoggingEvent event) {
    try {
      return Inet4Address.getLocalHost().getHostAddress();
    } catch (UnknownHostException e) {

    }
    return "";
  }

}
